package com.bz.xtcx.manager.mapper.provider;

import java.text.MessageFormat;

import com.bz.xtcx.manager.entity.CmsFiles;

public class CmsFileProvider {

	public String addAll(CmsFiles e){
		StringBuilder sql = new StringBuilder();
		sql.append("insert into `cms_file`(id, owner_type, owner_id, file_name, save_path, req_rel_url) values ");
        MessageFormat mf = new MessageFormat("(uuid(), #'{'ownerType}, #'{'id}, #'{'files[{0}].fileName}, #'{'savePath}, #'{'reqRelUrl} ),");
        for(int i = 0; i < e.getFiles().size(); i++) {
        	sql.append(mf.format(new Object[]{i}));
        }
        sql.deleteCharAt(sql.length() - 1);
		return sql.toString();
	}
}
